﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using CloudPms.Common.Log;
using CloudPms.Logic.Business;

namespace CloudPms.Web.Controllers
{
    public class HomeController : Controller
    {
        [HttpGet]
        public ActionResult Index()
        {
            //Session["Timer"] = "timer start";
            return View();
        }

        [HttpPost]
        public ActionResult Index(string name,int age)
        {
            Session["name"] = name;
            Session["age"] = age;
            OperateLog.InfoLog(new LogMessage(LogCategory.Option, "admin", "管理员", "O7550001841107000001",
                "无", "测试日志", true, "7550001", name+":"+age));
            return RedirectToAction("Index");
        }

        [HttpPost]
        public ActionResult AbandonSession()
        {
            try
            {
                throw new InvalidOperationException("日啊");
            }
            catch (Exception ex)
            {
                OperateLog.ErrorLog(ex);
                OperateLog.ErrorLog("Hello Error",ex);
                OperateLog.FatalLog("Hello Fatal",ex);
            }
            Session.Abandon();
            GC.Collect();
            return RedirectToAction("Index");
        }




    }
}
